@extends("admin.layout.main")
@section("content")
    <div class="tpl-content-wrapper">
        <div class="tpl-content-page-title">
            便捷分类
        </div>
        <ol class="am-breadcrumb">
            <li><a href="#" class="am-icon-home">首页</a></li>
            {{--<li><a href="#">分类管理</a></li>--}}
            <li class="am-active">分类管理</li>
        </ol>
        <div class="tpl-portlet-components">
            <div class="portlet-title">
                <div class="caption font-green bold">
                    <span class="am-icon-code"></span> 编辑分类
                </div>
            </div>

            <div class="tpl-block ">
                <div class="am-g tpl-amazeui-form">
                    <div class="am-u-sm-12 am-u-md-9">

                        <form class="am-form am-form-horizontal" method="post" action="/admin/type/{{$type->id}}/update">
                            {{csrf_field()}}
                            <div class="am-form-group">
                                <label for="user-phone" class="am-u-sm-3 am-form-label">所属分类</label>
                                <div class="am-u-sm-9">
                                    <select data-am-selected="{searchBox: 1}" name="tid">
                                        <option value=0>顶级分类</option>
                                        @foreach($top_lists as $list)
                                        <option value="{{$list->id}}" @if($list->id==$type->tid) selected @endif>{{$list->name}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">分类名称 </label>
                                <div class="am-u-sm-9">
                                    <input type="text" id="user-name" name="name" value="{{$type->name}}" minlength="2" placeholder="输入分类名称" class="am-form-field" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">权重 </label>
                                <div class="am-u-sm-9">
                                    <input type="text" id="user-name" name="weight"  value="{{$type->weight}}" class="am-form-field" >
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3">
                                    <button type="submit" class="am-btn am-btn-primary">保存</button>
                                </div>
                            </div>
                            <div class="tpl-alert"></div>
                            <div class="tpl-alert"></div>
                            <div class="tpl-alert"></div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        @include("admin.layout.error")
    </div>
@endsection